unit TempContas;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, DB, DBTables, Grids, DBGrids, StdCtrls, Mask, DBCtrls;

type
  TFtempcontas = class(TForm)
    DBGrid1: TDBGrid;
    Button2: TButton;
    Contas: TTable;
    DataSource1: TDataSource;
    ContasCodigo: TStringField;
    ContasNome: TStringField;
    ContasData: TDateField;
    ContasSaldoinicial: TFloatField;
    ContasSaldoatual: TFloatField;
    ContasTipo: TStringField;
    ContasGrupo: TStringField;
    Button3: TButton;
    Memo1: TMemo;
    DBEdit1: TDBEdit;
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Ftempcontas: TFtempcontas;

implementation

{$R *.dfm}

procedure TFtempcontas.Button2Click(Sender: TObject);
begin
close;
end;



procedure TFtempcontas.Button3Click(Sender: TObject);
var
temp : string;
begin
memo1.Lines.add('Despesas');
contas.First;
while not contas.Eof do
 begin
 if ContasSaldoatual.value = 0 then
    begin
    contas.next;
    continue;
 end;
 if copy(contascodigo.Value,1,2) = '51' then
    begin

    temp := contasnome.DisplayText + '                                                     ';
    temp := copy(temp,1,50);

    memo1.Lines.add(ContasCodigo.Value + ' - ' + temp +  formatfloat('###,##0.00',contassaldoatual.value));
 end;
 if copy(contascodigo.Value,1,2) = '52' then
    begin
    temp := contasnome.value + '                                                           ';
    temp := copy(temp,1,50);
    memo1.Lines.add(ContasCodigo.Value + ' - ' + temp  + formatfloat('###,##0.00',contassaldoatual.value));
 end;
 contas.Next;
end;
end;
end.
